package cacy.leetcode.linkedList;

/**
 * Project: LeetcodePractice
 * Package: cacy.leetcode.practice20250217
 * Class:   ListNode
 * Description:
 *
 * @Date: 2025/2/17 周一
 * @Time: 14:29
 * @Author: 凯齐
 */

public class ListNode {
    int val;
    ListNode next;

    ListNode() {}

    ListNode(int val) {
        this.val = val;
    }

    ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    public void push(int val) {
        ListNode newNode = new ListNode(val);
        ListNode node = this;
        while (node.next != null) {
            node = node.next;
        }
        node.next = newNode;
    }
}
